
package cn.springmvc.controller;

import cn.springmvc.model.User;
import cn.springmvc.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;


@Controller
@RequestMapping(value = "/main")
public class MainController {
    @Autowired
    private UserService service;

    @RequestMapping(value = "/index")
    public String index() {
        User user = new User();
        user.setPassword("123456");
        user.setUsername("kennedy");
        service.insertUser(user);
        return "index";
    }

}
